-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DO NOT LAND] Process only changed metrics #236
base: master
Are you sure you want to change the base?
Conversation
s.reportChanges(counters, gauges) | ||
s.cachedReporter.Flush() | ||
// Reset the changed counters and gauges | ||
counters = counters[:0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need to set the elements in the slice to the zero value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what we talked about -- https://go.dev/play/p/WIRovDFJhE5
for { | ||
select { | ||
case c := <-s.counterChangeNotifyCh: | ||
counters = append(counters, c) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what happens if c
is part of a subscope that's closed before you process it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed, this will have the effect of flushing out any pending accumulated metrics which is desirable.
separator: sanitizer.Name(opts.Separator), | ||
timers: make(map[string]*timer), | ||
root: true, | ||
counterChangeNotifyCh: make(chan *counter, 1024), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm few thoughts about this channel
- any concerns about blocking once we hit the limit?
- how did you arrive at this size?
- maybe this should be configurable too? (akin to https://github.com/uber-go/tally/blob/master/m3/reporter.go#L160 for eg)
PoC purposes only
Only applies to counters and gauges at the moment (not histograms)